﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Web.Http;
using System.Web.Http.Filters;
using Newtonsoft.Json.Linq;
using ProjectBase.Core;

using $prjsn$.Entity;
using $prjsn$.Common.Business;

namespace $safeprojectname$
{
    public class LogFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext context)
        {
            PublishingManager.Publish(this
                , () => "Action {0} of a Service {1} STARTED. URl {2}"
                .FormatWith(context.ActionDescriptor.ActionName
                    , context.ActionDescriptor.ControllerDescriptor.ControllerName
                    , context.Request.RequestUri)
                , Severity.Debug
                );
        }
        public override void OnActionExecuted(HttpActionExecutedContext context)
        {
            PublishingManager.Publish(this
                , () => "Action {0} of a Service {1} FINISHED"
                .FormatWith(context.ActionContext.ActionDescriptor.ActionName
                    , context.ActionContext.ControllerContext.ControllerDescriptor.ControllerName)
                , Severity.Debug
                );
        }
    }
}
